using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Core_HGUI_PopulateStringInfo_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Core.HGUI.PopulateStringInfo);

            field = type.GetField("ch", flag);
            app.RegisterCLRFieldGetter(field, get_ch_0);
            app.RegisterCLRFieldSetter(field, set_ch_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_ch_0, AssignFromStack_ch_0);
            field = type.GetField("fontSize", flag);
            app.RegisterCLRFieldGetter(field, get_fontSize_1);
            app.RegisterCLRFieldSetter(field, set_fontSize_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_fontSize_1, AssignFromStack_fontSize_1);
            field = type.GetField("style", flag);
            app.RegisterCLRFieldGetter(field, get_style_2);
            app.RegisterCLRFieldSetter(field, set_style_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_style_2, AssignFromStack_style_2);
            field = type.GetField("type", flag);
            app.RegisterCLRFieldGetter(field, get_type_3);
            app.RegisterCLRFieldSetter(field, set_type_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_type_3, AssignFromStack_type_3);
            field = type.GetField("VertexIndex", flag);
            app.RegisterCLRFieldGetter(field, get_VertexIndex_4);
            app.RegisterCLRFieldSetter(field, set_VertexIndex_4);
            app.RegisterCLRFieldBinding(field, CopyToStack_VertexIndex_4, AssignFromStack_VertexIndex_4);

            app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone);

            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Core.HGUI.PopulateStringInfo());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Core.HGUI.PopulateStringInfo[s]);


        }

        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref huqiang.Core.HGUI.PopulateStringInfo instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch(ptr_of_this_method->ObjectType)
            {
                case ObjectTypes.Object:
                    {
                        __mStack[ptr_of_this_method->Value] = instance_of_this_method;
                    }
                    break;
                case ObjectTypes.FieldReference:
                    {
                        var ___obj = __mStack[ptr_of_this_method->Value];
                        if(___obj is ILTypeInstance)
                        {
                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            var t = __domain.GetType(___obj.GetType()) as CLRType;
                            t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                        }
                    }
                    break;
                case ObjectTypes.StaticFieldReference:
                    {
                        var t = __domain.GetType(ptr_of_this_method->Value);
                        if(t is ILType)
                        {
                            ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                        }
                    }
                    break;
                 case ObjectTypes.ArrayReference:
                    {
                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as huqiang.Core.HGUI.PopulateStringInfo[];
                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
                    }
                    break;
            }
        }


        static object get_ch_0(ref object o)
        {
            return ((huqiang.Core.HGUI.PopulateStringInfo)o).ch;
        }

        static StackObject* CopyToStack_ch_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Core.HGUI.PopulateStringInfo)o).ch;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static void set_ch_0(ref object o, object v)
        {
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.ch = (System.Char)v;
            o = ins;
        }

        static StackObject* AssignFromStack_ch_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Char @ch = (char)ptr_of_this_method->Value;
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.ch = @ch;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_fontSize_1(ref object o)
        {
            return ((huqiang.Core.HGUI.PopulateStringInfo)o).fontSize;
        }

        static StackObject* CopyToStack_fontSize_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Core.HGUI.PopulateStringInfo)o).fontSize;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_fontSize_1(ref object o, object v)
        {
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.fontSize = (System.Int32)v;
            o = ins;
        }

        static StackObject* AssignFromStack_fontSize_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @fontSize = ptr_of_this_method->Value;
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.fontSize = @fontSize;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_style_2(ref object o)
        {
            return ((huqiang.Core.HGUI.PopulateStringInfo)o).style;
        }

        static StackObject* CopyToStack_style_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Core.HGUI.PopulateStringInfo)o).style;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_style_2(ref object o, object v)
        {
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.style = (UnityEngine.FontStyle)v;
            o = ins;
        }

        static StackObject* AssignFromStack_style_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.FontStyle @style = (UnityEngine.FontStyle)typeof(UnityEngine.FontStyle).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)20);
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.style = @style;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_type_3(ref object o)
        {
            return ((huqiang.Core.HGUI.PopulateStringInfo)o).type;
        }

        static StackObject* CopyToStack_type_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Core.HGUI.PopulateStringInfo)o).type;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_type_3(ref object o, object v)
        {
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.type = (System.Int32)v;
            o = ins;
        }

        static StackObject* AssignFromStack_type_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @type = ptr_of_this_method->Value;
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.type = @type;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_VertexIndex_4(ref object o)
        {
            return ((huqiang.Core.HGUI.PopulateStringInfo)o).VertexIndex;
        }

        static StackObject* CopyToStack_VertexIndex_4(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Core.HGUI.PopulateStringInfo)o).VertexIndex;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_VertexIndex_4(ref object o, object v)
        {
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.VertexIndex = (System.Int32)v;
            o = ins;
        }

        static StackObject* AssignFromStack_VertexIndex_4(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @VertexIndex = ptr_of_this_method->Value;
            huqiang.Core.HGUI.PopulateStringInfo ins =(huqiang.Core.HGUI.PopulateStringInfo)o;
            ins.VertexIndex = @VertexIndex;
            o = ins;
            return ptr_of_this_method;
        }


        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new huqiang.Core.HGUI.PopulateStringInfo();
            ins = (huqiang.Core.HGUI.PopulateStringInfo)o;
            return ins;
        }


    }
}
